package com.ricettario.ricettario;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class RicettarioMain extends Activity {

	private static final String CLASS_TAG = "RicettarioMain";
	public final static String EXTRA_MESSAGE = "com.ricettario.ricettario.USERNAME";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	Log.d(CLASS_TAG, "Entering in onCreate...");
        super.onCreate(savedInstanceState);
        Log.d(CLASS_TAG, "Superclass constructor invoked");
        setContentView(R.layout.activity_ricettario_main);
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	Log.d(CLASS_TAG, "Entering in onCreateOptionMenu...");
        getMenuInflater().inflate(R.menu.activity_ricettario_main, menu);
        return true;
    }
    
    public void insertName(View view){
    	Intent intent = new Intent(this, CategoryMenu.class);
    	EditText editTextName = (EditText) findViewById(R.id.editTextName);
    	Log.d(CLASS_TAG, "editTextName taken? " + (editTextName!=null));
    	String username = editTextName.getText().toString();
    	Log.i(CLASS_TAG, "username: " + username);
    	intent.putExtra(EXTRA_MESSAGE, username);
    	startActivity(intent);
    	
    }
}
